<!DOCTYPE html>
<html>
<head>
	<meta charset="utf-8">
	<title>文章添加--layui后台管理模板</title>
	<meta name="renderer" content="webkit">
	<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
	<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
	<meta name="apple-mobile-web-app-status-bar-style" content="black">
	<meta name="apple-mobile-web-app-capable" content="yes">
	<meta name="format-detection" content="telephone=no">
	<link rel="stylesheet" href="../../layui/css/layui.css" media="all" />
</head>
<body class="childrenBody">
<form class="layui-form" style="width:80%;">
	<div class="layui-form-item">
		<label class="layui-form-label">用户名</label>
		<div class="layui-input-block">
			<input type="text" name="username" class="layui-input linksName" placeholder="请输入用户名">
		</div>
	</div>
	<div class="layui-form-item">
		<label class="layui-form-label">手机号</label>
		<div class="layui-input-block">
			<input type="tel" name="phone" class="layui-input linksUrl" placeholder="请输入手机号">
		</div>
	</div>
	<div class="layui-form-item">
		<label class="layui-form-label">密码</label>
		<div class="layui-input-block">
			<input type="password" name="password" class="layui-input linksDesc" placeholder="请设置密码">
		</div>
	</div>
	<div class="layui-form-item">
		<div class="layui-input-block">
			<button class="layui-btn" lay-submit="" lay-filter="addLinks">立即提交</button>
			<button type="reset" class="layui-btn layui-btn-primary">重置</button>
		</div>
	</div>
</form>
<script type="text/javascript" src="../../layui/layui.js"></script>
<script>
	layui.config({
		base: "js/"
	}).use(['form', 'layer'], function () {
		var form = layui.form(),
				layer = parent.layer === undefined ? layui.layer : parent.layer,
				$ = layui.jquery;

		//登录按钮事件
		form.on("submit(addLinks)", function (data) {
			var  pwd=document.getElementsByName("password")[0].value;
			var userid=document.getElementsByName("username")[0].value;
			var phone=document.getElementsByName("phone")[0].value;
			console.log(pwd);
			console.log(userid);
			console.log(phone);
			$.ajax({
				url: "http://localhost:8080/com.3group.personality/admin/adminRegister?adminid=" +userid+"&pwd="+pwd+"&phone="+phone,
				type: "get",
				dataType: "text",
				success: function (datas) {
					alert(datas)
					if (datas=="error" ) {
						alert(datas)
					} else if (datas=="success") {
						window.location.href = "linksList.html";
					}
				}
			})
			return false;
		})
	})

</script>
<!--	<script type="text/javascript" src="linksAdd.js"></script>-->
</body>
</html>